import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class Deo4 {
    public static void main(String[] args) {
        try(Writer writer = new FileWriter("d:/text.txt")) {
            writer.write("原神，启动！");//写入，先清空再写入
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    /*  在构造方法参数中加一个 true , 就可以直接在文件后面填写，不需要清空
        try(Writer writer1 = new FileWriter("d:/text.txt",true)) {
            writer1.write("原神，启动！");//写入
        } catch (IOException e) {
            throw new RuntimeException(e);
        }*/
    }
}
